﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swagger.Config.Middlewares;
using Swagger.Config.ServiceExtensions;

namespace Swagger.Config
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            //services.AddControllersWithViews(); .net8.0 这样写
            services.AddMvc();
            services.AddSwagger();
        }

        public void Configure(IApplicationBuilder app)
        {
            // 启用Swagger中间件
            app.UseSwagger(); 
            app.UseMvc();


            //app.UseRouting();  .net8.0 这样写
            //app.UseEndpoints(endpoints =>  .net8.0 这样写
            //{
            //    endpoints.MapControllers();
            //});
        }
    }
}
